Semantics of Imperative Objects
نویسندگان
چکیده
Context. The object calculi of Abadi and Cardelli provide idealized models of object-oriented programming languages [1]. They have rigorously defined semantics, and they are simple since only objects are considered as primitives. At the same time they are expressive enough to encode all common features of practical (i.e., class-based) object-oriented programming languages like classes, subtyping and inheritance. In this work we will study the semantics of a variant of Abadi and Cardelli's imperative object calculus, as presented by Abadi and Leino [2]. This calculus is particularly interesting since it combines objects with dynamically allocated, higher-order store. While higher-order store is present in different forms in almost all practical programming languages (pointers to functions in C, callbacks in Java, or general references in ML), it is challenging to find good semantic models in which one can reason about the behaviour of programs. Syntactic arguments, based solely on the operational semantics, suffice to prove properties such as type preservation, but are not suitable as a basis for program logics like that of Abadi and Leino [2]. We believe that specifications of program behaviour should have a meaning independent of the particular proof system on which syntactic preservation proofs rely [7, 6, 10]. On the other hand, a "classical" denotational semantics of higher-order store based on partial orders tends to become rather complex. In fact, modelling dynamic allocation alone usually means that one has to move to a possible-world model, formalized as a category of functors over cpos. While this achieves the goal of separating the notion of logical validity from derivability, the known models are not very abstract in that many natural equivalences involving state do not hold. An alternative is to use a step-indexed semantics, an approach developed by Appel and his collaborators in the context of foundational proof-carrying code [5]. Based on a small-step operational semantics, types are interpreted as sets of indexed values. Informally, an expression has a certain type if it behaves like an element of that type for a fixed number of steps. The usual type inference rules then become derived lemmas, and type safety of the operational semantics is an immediate consequence of this interpretation of types. A step-indexed semantics has been introduced for lambda calculus with recursive and poly-morphic types in [5]. Later this has been successfully extended to an imperative language with general references and impredicative polymorphism [3], substructural state [4], and has also …
منابع مشابه
Declarative Semantics in Object-Oriented Software Development - A Taxonomy and Survey
One of the modern paradigms to develop an application is object oriented analysis and design. In this paradigm, there are several objects and each object plays some specific roles in applications. In an application, we must distinguish between procedural semantics and declarative semantics for their implementation in a specific programming language. For the procedural semantics, we can write a ...
متن کاملLinearity, Sharing and State: a Fully Abstract Game Semantics for Idealized Algol with Active Expressions Extended Abstract Abramsky and Mccusker
The manipulation of objects with state which changes over time is all-pervasive in computing. Perhaps the simplest example of such objects are the program variables of classical imperative languages. An important strand of work within the study of such languages, pioneered by John Reynolds, focusses on \Idealized Algol", an elegant synthesis of imperative and functional features. We present a n...
متن کاملAn Imperative Object Calculus Basic Typing and Soundness
We develop an imperative calculus of objects that is both tiny and expressive. Our calculus provides a minimal setting in which to study the operational semantics and the typing rules of object-oriented languages. We prove type soundness using a simple subject-reduction approach.
متن کاملFlow Logic for Imperative Objects
We develop a control ow analysis for the Imperative Object Calculus. We prove the correctness with respect to two Structural Operational Semantics that diier in minor technical ways, and we show that the proofs deviate in major ways as regards their use of proof techniques like coinduction and Kripke-logical relations.
متن کاملOn the Design of Generic Static Analyzers for Imperative Languages
The design and implementation of precise static analyzers for significant fragments of imperative languages like C, C++, Java and Python is a challenging problem. In this paper, we consider a core imperative language that has several features found in mainstream languages such as those including recursive functions, run-time system and user-defined exceptions, and a realistic data and memory mo...
متن کاملDenotational Semantics for Abadi and Leino's Logic of Objects
Abadi-Leino Logic is a Hoare-calculus style logic for a simple imperative and object-based language where every object comes with its own method suite. Consequently, methods need to reside in the store (”higher-order store”). We present a new soundness proof for this logic using a denotational semantics where object specifications are recursive predicates on the domain of objects. Our semantics...
متن کامل